<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<script>
  //Promise 是一种异步编程的方式
  //参数=>函数(resolve,reject)
  //resolve,reject 它们本身就是函数
  //这是一种链式编程
  new Promise((resolve, reject) => {
//第一次网络请求的代码
    setTimeout(() => {
      resolve()
    }, 1000)
  }).then(() => {
//第一次拿到结果的处理代码
    console.log('Hello World');
    console.log('Hello World');
    console.log('Hello World');
    console.log('Hello World');
    console.log('Hello World');
    console.log('Hello World');

    return new Promise((resolve, reject) => {
//第二次网络请求的代码
      setTimeout(() => {
        resolve()
      }, 1000)
    }).then(() => {
//第二次拿到结果的代码
      console.log('Hello Vue.Js');
      console.log('Hello Vue.Js');
      console.log('Hello Vue.Js');
      console.log('Hello Vue.Js');
      console.log('Hello Vue.Js');
      console.log('Hello Vue.Js');

      return new Promise((resolve, reject) => {
//第三次网络请求的代码
        setTimeout(() => {
          resolve()//调用resolve处理结果(then中的)
        }, 1000)
      }).then(() => {
//第三次拿到结果的代码
        console.log('Hello Java');
        console.log('Hello Java');
        console.log('Hello Java');
        console.log('Hello Java');
        console.log('Hello Java');
        console.log('Hello Java');
      })
    })
  })
</script>
</body>
</html>
